package com.lyxy.test;

public class PersonTest {
    public static void main(String[] args) {


        System.out.println("-----正常方法调用-----");

        Person2 h1 = new Person2();
        h1.eat();
        h1.StewedVegetables();
        h1.SteamedBuns();
        System.out.println();

        Person3 h2 = new Person3();
        h2.eat();
        h2.FriedVegetables();
        h2.Rice();

        System.out.println("-----多态方法调用-----");
        Person h3 = new Person2();
        h3.eat();
        Person h4 = new Person3();
        h4.eat();
        System.out.println();

        Person2 h5 = (Person2) h3;
        h5.eat();
        h5.StewedVegetables();
        h5.SteamedBuns();
        System.out.println();

        Person3 h6 = (Person3) h4;
        h6.eat();
        h6.FriedVegetables();
        h6.Rice();
    }
}